//
//  TheirdViewController.m
//  UI_21通知
//
//  Created by dllo on 15/11/6.
//  Copyright (c) 2015年 关业达. All rights reserved.
//

#import "TheirdViewController.h"

@interface TheirdViewController ()

@end

@implementation TheirdViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.view.backgroundColor = [UIColor whiteColor];
    
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    button.frame = CGRectMake(100, 100, 100, 100);
    button.backgroundColor = [UIColor redColor];
    [self.view addSubview:button];
    [button addTarget:self action:@selector(buttonAction:) forControlEvents:UIControlEventTouchUpInside];
    
//    // 发送一个消息通知
//    // 参数2. 发送消息是传递的值
//    [[NSNotificationCenter defaultCenter] postNotificationName:@"ChangeColor" object:[UIColor brownColor]];
    
    
    
}

- (void)buttonAction:(UIButton *)btn
{
    // 发送一个消息通知
    // 参数2. 发送消息是传递的值
    [[NSNotificationCenter defaultCenter] postNotificationName:@"ChangeColor" object:[UIColor brownColor]];
    [self.navigationController popToRootViewControllerAnimated:YES];
}




- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
